.class public Lcom/xingbook/ui/s;
.super Landroid/view/View;

# interfaces
.implements Ljava/lang/Runnable;


# annotations
.annotation build Landroid/annotation/SuppressLint;
    value = {
        "ViewConstructor"
    }
.end annotation


# static fields
.field private static b:Landroid/graphics/Paint;


# instance fields
.field public a:Z

.field private c:I

.field private d:I

.field private e:Ljava/lang/String;

.field private f:Ljava/lang/Object;

.field private g:F

.field private h:I

.field private i:I

.field private j:Z

.field private k:I

.field private l:F

.field private m:F


# direct methods
.method static constructor <clinit>()V
    .locals 1

    const/4 v0, 0x0

    sput-object v0, Lcom/xingbook/ui/s;->b:Landroid/graphics/Paint;

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;)V
    .locals 4

    const/4 v3, 0x1

    const/4 v2, -0x1

    const/4 v1, 0x0

    invoke-direct {p0, p1}, Landroid/view/View;-><init>(Landroid/content/Context;)V

    iput v1, p0, Lcom/xingbook/ui/s;->c:I

    iput v1, p0, Lcom/xingbook/ui/s;->d:I

    new-instance v0, Ljava/lang/Object;

    invoke-direct {v0}, Ljava/lang/Object;-><init>()V

    iput-object v0, p0, Lcom/xingbook/ui/s;->f:Ljava/lang/Object;

    const/high16 v0, 0x41a0

    iput v0, p0, Lcom/xingbook/ui/s;->g:F

    iput v2, p0, Lcom/xingbook/ui/s;->h:I

    const/16 v0, 0x13

    iput v0, p0, Lcom/xingbook/ui/s;->i:I

    iput-boolean v3, p0, Lcom/xingbook/ui/s;->a:Z

    iput-boolean v1, p0, Lcom/xingbook/ui/s;->j:Z

    iput v1, p0, Lcom/xingbook/ui/s;->k:I

    sget-object v0, Lcom/xingbook/ui/s;->b:Landroid/graphics/Paint;

    if-nez v0, :cond_0

    new-instance v0, Landroid/graphics/Paint;

    invoke-direct {v0}, Landroid/graphics/Paint;-><init>()V

    sput-object v0, Lcom/xingbook/ui/s;->b:Landroid/graphics/Paint;

    sget-object v0, Lcom/xingbook/ui/s;->b:Landroid/graphics/Paint;

    invoke-virtual {v0, v3}, Landroid/graphics/Paint;->setFlags(I)V

    sget-object v0, Lcom/xingbook/ui/s;->b:Landroid/graphics/Paint;

    invoke-virtual {v0, v2}, Landroid/graphics/Paint;->setColor(I)V

    sget-object v0, Lcom/xingbook/ui/s;->b:Landroid/graphics/Paint;

    sget-object v1, Landroid/graphics/Paint$Align;->LEFT:Landroid/graphics/Paint$Align;

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setTextAlign(Landroid/graphics/Paint$Align;)V

    :cond_0
    return-void
.end method

.method private declared-synchronized getNeedMarquee()Z
    .locals 1

    monitor-enter p0

    :try_start_0
    iget-boolean v0, p0, Lcom/xingbook/ui/s;->j:Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    monitor-exit p0

    return v0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method private declared-synchronized setNeedMarquee(Z)V
    .locals 2

    monitor-enter p0

    :try_start_0
    iget-boolean v0, p0, Lcom/xingbook/ui/s;->j:Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    if-ne v0, p1, :cond_0

    :goto_0
    monitor-exit p0

    return-void

    :cond_0
    const/4 v0, 0x0

    :try_start_1
    iput v0, p0, Lcom/xingbook/ui/s;->k:I

    if-eqz p1, :cond_1

    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/xingbook/ui/s;->j:Z

    new-instance v0, Ljava/lang/Thread;

    invoke-direct {v0, p0}, Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;)V

    invoke-virtual {v0}, Ljava/lang/Thread;->start()V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0

    :cond_1
    const/4 v0, 0x0

    :try_start_2
    iput-boolean v0, p0, Lcom/xingbook/ui/s;->j:Z

    iget-object v1, p0, Lcom/xingbook/ui/s;->f:Ljava/lang/Object;

    monitor-enter v1
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    :try_start_3
    iget-object v0, p0, Lcom/xingbook/ui/s;->f:Ljava/lang/Object;

    invoke-virtual {v0}, Ljava/lang/Object;->notify()V

    monitor-exit v1

    goto :goto_0

    :catchall_1
    move-exception v0

    monitor-exit v1
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_1

    :try_start_4
    throw v0
    :try_end_4
    .catchall {:try_start_4 .. :try_end_4} :catchall_0
.end method


# virtual methods
.method public getTextcolor()I
    .locals 1

    iget v0, p0, Lcom/xingbook/ui/s;->h:I

    return v0
.end method

.method public getTextsize()F
    .locals 1

    iget v0, p0, Lcom/xingbook/ui/s;->g:F

    return v0
.end method

.method protected onDraw(Landroid/graphics/Canvas;)V
    .locals 4

    const/high16 v3, 0x4000

    sget-object v0, Lcom/xingbook/ui/s;->b:Landroid/graphics/Paint;

    iget v1, p0, Lcom/xingbook/ui/s;->g:F

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setTextSize(F)V

    sget-object v0, Lcom/xingbook/ui/s;->b:Landroid/graphics/Paint;

    iget v1, p0, Lcom/xingbook/ui/s;->h:I

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V

    iget-object v0, p0, Lcom/xingbook/ui/s;->e:Ljava/lang/String;

    if-eqz v0, :cond_0

    const-string v0, ""

    iget-object v1, p0, Lcom/xingbook/ui/s;->e:Ljava/lang/String;

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_0

    sget-object v0, Lcom/xingbook/ui/s;->b:Landroid/graphics/Paint;

    iget-object v1, p0, Lcom/xingbook/ui/s;->e:Ljava/lang/String;

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->measureText(Ljava/lang/String;)F

    move-result v0

    iput v0, p0, Lcom/xingbook/ui/s;->l:F

    sget-object v0, Lcom/xingbook/ui/s;->b:Landroid/graphics/Paint;

    invoke-virtual {v0}, Landroid/graphics/Paint;->getFontMetrics()Landroid/graphics/Paint$FontMetrics;

    move-result-object v0

    iget v1, p0, Lcom/xingbook/ui/s;->c:I

    int-to-float v1, v1

    iget v2, v0, Landroid/graphics/Paint$FontMetrics;->descent:F

    sub-float/2addr v1, v2

    iget v0, v0, Landroid/graphics/Paint$FontMetrics;->ascent:F

    sub-float v0, v1, v0

    div-float v1, v0, v3

    iget v0, p0, Lcom/xingbook/ui/s;->l:F

    iget v2, p0, Lcom/xingbook/ui/s;->d:I

    int-to-float v2, v2

    cmpl-float v0, v0, v2

    if-lez v0, :cond_1

    iget-boolean v0, p0, Lcom/xingbook/ui/s;->a:Z

    if-eqz v0, :cond_1

    sget-object v0, Lcom/xingbook/ui/s;->b:Landroid/graphics/Paint;

    const-string v2, "        "

    invoke-virtual {v0, v2}, Landroid/graphics/Paint;->measureText(Ljava/lang/String;)F

    move-result v0

    iput v0, p0, Lcom/xingbook/ui/s;->m:F

    new-instance v0, Ljava/lang/StringBuilder;

    iget-object v2, p0, Lcom/xingbook/ui/s;->e:Ljava/lang/String;

    invoke-static {v2}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v2

    invoke-direct {v0, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v2, "        "

    invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    iget-object v2, p0, Lcom/xingbook/ui/s;->e:Ljava/lang/String;

    invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    iget v2, p0, Lcom/xingbook/ui/s;->k:I

    int-to-float v2, v2

    sget-object v3, Lcom/xingbook/ui/s;->b:Landroid/graphics/Paint;

    invoke-virtual {p1, v0, v2, v1, v3}, Landroid/graphics/Canvas;->drawText(Ljava/lang/String;FFLandroid/graphics/Paint;)V

    const/4 v0, 0x1

    invoke-direct {p0, v0}, Lcom/xingbook/ui/s;->setNeedMarquee(Z)V

    :cond_0
    :goto_0
    return-void

    :cond_1
    iget v0, p0, Lcom/xingbook/ui/s;->i:I

    and-int/lit8 v0, v0, 0x3

    const/4 v2, 0x3

    if-ne v0, v2, :cond_2

    const/4 v0, 0x0

    :goto_1
    const/4 v2, 0x0

    invoke-direct {p0, v2}, Lcom/xingbook/ui/s;->setNeedMarquee(Z)V

    iget-object v2, p0, Lcom/xingbook/ui/s;->e:Ljava/lang/String;

    sget-object v3, Lcom/xingbook/ui/s;->b:Landroid/graphics/Paint;

    invoke-virtual {p1, v2, v0, v1, v3}, Landroid/graphics/Canvas;->drawText(Ljava/lang/String;FFLandroid/graphics/Paint;)V

    goto :goto_0

    :cond_2
    iget v0, p0, Lcom/xingbook/ui/s;->i:I

    and-int/lit8 v0, v0, 0x5

    const/4 v2, 0x5

    if-ne v0, v2, :cond_3

    iget v0, p0, Lcom/xingbook/ui/s;->d:I

    int-to-float v0, v0

    iget v2, p0, Lcom/xingbook/ui/s;->l:F

    sub-float/2addr v0, v2

    goto :goto_1

    :cond_3
    iget v0, p0, Lcom/xingbook/ui/s;->d:I

    int-to-float v0, v0

    iget v2, p0, Lcom/xingbook/ui/s;->l:F

    sub-float/2addr v0, v2

    div-float/2addr v0, v3

    goto :goto_1
.end method

.method protected onLayout(ZIIII)V
    .locals 1

    sub-int v0, p4, p2

    iput v0, p0, Lcom/xingbook/ui/s;->d:I

    sub-int v0, p5, p3

    iput v0, p0, Lcom/xingbook/ui/s;->c:I

    invoke-super/range {p0 .. p5}, Landroid/view/View;->onLayout(ZIIII)V

    return-void
.end method

.method public run()V
    .locals 4

    :try_start_0
    iget-object v1, p0, Lcom/xingbook/ui/s;->f:Ljava/lang/Object;

    monitor-enter v1
    :try_end_0
    .catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0

    :try_start_1
    iget-object v0, p0, Lcom/xingbook/ui/s;->f:Ljava/lang/Object;

    const-wide/16 v2, 0x7d0

    invoke-virtual {v0, v2, v3}, Ljava/lang/Object;->wait(J)V

    monitor-exit v1
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    :goto_0
    invoke-direct {p0}, Lcom/xingbook/ui/s;->getNeedMarquee()Z

    move-result v0

    if-nez v0, :cond_0

    return-void

    :catchall_0
    move-exception v0

    :try_start_2
    monitor-exit v1
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    :try_start_3
    throw v0
    :try_end_3
    .catch Ljava/lang/InterruptedException; {:try_start_3 .. :try_end_3} :catch_0

    :catch_0
    move-exception v0

    invoke-virtual {v0}, Ljava/lang/InterruptedException;->printStackTrace()V

    goto :goto_0

    :cond_0
    :try_start_4
    iget v0, p0, Lcom/xingbook/ui/s;->k:I

    if-nez v0, :cond_1

    invoke-virtual {p0}, Lcom/xingbook/ui/s;->postInvalidate()V

    iget v0, p0, Lcom/xingbook/ui/s;->k:I

    add-int/lit8 v0, v0, -0x1

    iput v0, p0, Lcom/xingbook/ui/s;->k:I

    iget-object v1, p0, Lcom/xingbook/ui/s;->f:Ljava/lang/Object;

    monitor-enter v1
    :try_end_4
    .catch Ljava/lang/Exception; {:try_start_4 .. :try_end_4} :catch_1

    :try_start_5
    iget-object v0, p0, Lcom/xingbook/ui/s;->f:Ljava/lang/Object;

    const-wide/16 v2, 0x5dc

    invoke-virtual {v0, v2, v3}, Ljava/lang/Object;->wait(J)V

    monitor-exit v1

    goto :goto_0

    :catchall_1
    move-exception v0

    monitor-exit v1
    :try_end_5
    .catchall {:try_start_5 .. :try_end_5} :catchall_1

    :try_start_6
    throw v0

    :catch_1
    move-exception v0

    goto :goto_0

    :cond_1
    invoke-virtual {p0}, Lcom/xingbook/ui/s;->postInvalidate()V

    iget v0, p0, Lcom/xingbook/ui/s;->k:I

    add-int/lit8 v0, v0, -0x1

    iput v0, p0, Lcom/xingbook/ui/s;->k:I

    iget v0, p0, Lcom/xingbook/ui/s;->k:I

    invoke-static {v0}, Ljava/lang/Math;->abs(I)I

    move-result v0

    int-to-float v0, v0

    iget v1, p0, Lcom/xingbook/ui/s;->l:F

    iget v2, p0, Lcom/xingbook/ui/s;->m:F

    add-float/2addr v1, v2

    cmpl-float v0, v0, v1

    if-ltz v0, :cond_2

    const/4 v0, 0x0

    iput v0, p0, Lcom/xingbook/ui/s;->k:I

    :cond_2
    iget-object v1, p0, Lcom/xingbook/ui/s;->f:Ljava/lang/Object;

    monitor-enter v1
    :try_end_6
    .catch Ljava/lang/Exception; {:try_start_6 .. :try_end_6} :catch_1

    :try_start_7
    iget-object v0, p0, Lcom/xingbook/ui/s;->f:Ljava/lang/Object;

    const-wide/16 v2, 0x14

    invoke-virtual {v0, v2, v3}, Ljava/lang/Object;->wait(J)V

    monitor-exit v1

    goto :goto_0

    :catchall_2
    move-exception v0

    monitor-exit v1
    :try_end_7
    .catchall {:try_start_7 .. :try_end_7} :catchall_2

    :try_start_8
    throw v0
    :try_end_8
    .catch Ljava/lang/Exception; {:try_start_8 .. :try_end_8} :catch_1
.end method

.method public setGravity(I)V
    .locals 0

    iput p1, p0, Lcom/xingbook/ui/s;->i:I

    return-void
.end method

.method public setTextcolor(I)V
    .locals 0

    iput p1, p0, Lcom/xingbook/ui/s;->h:I

    return-void
.end method

.method public setTextsize(F)V
    .locals 0

    iput p1, p0, Lcom/xingbook/ui/s;->g:F

    return-void
.end method

.method public setTitle(Ljava/lang/String;)V
    .locals 1

    const/4 v0, 0x0

    iput v0, p0, Lcom/xingbook/ui/s;->k:I

    const/4 v0, 0x0

    iput v0, p0, Lcom/xingbook/ui/s;->l:F

    iput-object p1, p0, Lcom/xingbook/ui/s;->e:Ljava/lang/String;

    invoke-virtual {p0}, Lcom/xingbook/ui/s;->invalidate()V

    return-void
.end method
